package com.aaa.maintain.service.impl;

import com.aaa.entity.MainRecord;
import com.aaa.maintain.dao.MainRecordDao;
import com.aaa.maintain.service.MainRecordService;
import com.aaa.vo.MainRecordVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 荆豪峰
 * @version 1.0
 * #Date: 2023/3/1 13:47
 */
@Service
public class MainRecordServiceImpl extends ServiceImpl<MainRecordDao, MainRecord> implements MainRecordService {
    @Autowired
    private MainRecordDao mainRecordDao;
    @Override
    public Result list(Integer currentPage, Integer pageSize, MainRecordVo mainRecordVo) {
        PageHelper.startPage(currentPage, pageSize);
        List<MainRecordVo> sysDictTypes = mainRecordDao.selectListName(mainRecordVo.getCarname());
        PageInfo<MainRecordVo> sysDictTypePageInfo = new PageInfo<>(sysDictTypes);
        return new Result(2000,"成功",sysDictTypePageInfo);
    }

    @Override
    public Result delete(Integer id) {
        int i = mainRecordDao.deleteById(id);
        return new Result(2000,"成功",i);
    }

}
